-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some bugs in TypeCoercion rule #3407
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3407 +/- ##
==========================================
+ Coverage 85.49% 85.63% +0.13%
==========================================
Files 296 296
Lines 54331 54512 +181
==========================================
+ Hits 46448 46679 +231
+ Misses 7883 7833 -50
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…used by recent merges to master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I had a small question about casting Date32 -> date64 but otherwise this looks like a nice improvement to me
)?), | ||
_ => DFSchemaRef::new(DFSchema::empty()), | ||
}; | ||
// get schema representing all available input fields. This is used for data type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
DataType::Date32 | DataType::Date64 | DataType::Timestamp(_, _), | ||
&DataType::Interval(_), | ||
) => { | ||
// Arrow `can_cast_types` says we cannot cast an Interval to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes sense to cast an interval to a specific point in time -- aka I think DataFusion's coerce_types is incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am tracking this as part of #3419
let expr_type = expr.get_type(&self.schema)?; | ||
let low_type = low.get_type(&self.schema)?; | ||
let coerced_type = comparison_coercion(&expr_type, &low_type) | ||
.ok_or_else(|| DataFusionError::Internal("".to_string()))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the empty error message? That seems like it may be confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops .. forgot to go back and finish this. I have pushed a fix.
@@ -244,6 +283,34 @@ mod test { | |||
Ok(()) | |||
} | |||
|
|||
#[test] | |||
fn binary_op_date32_add_interval() -> Result<()> { | |||
//CAST(Utf8("1998-03-18") AS Date32) + IntervalDayTime("386547056640") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
I will review tomorrow, please hold it |
@liukun4515 do you still want us to hold this PR for your review? |
I'd prefer that we get these bug fixes merged to unblock some other items. Arrow is still following the "Commit-Then-Review" (C-T-R) policy:
In other words, we can continue with the review after merge, and revert the PR if it proves to be problematic. |
I agree -- let's merge this PR and we can either revert it or address comments in a follow on PR if/when provided by @liukun4515 Thanks all! |
Benchmark runs are scheduled for baseline = 3e56a0f and contender = 7427a80. 7427a80 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Part of #3390
Rationale for this change
This PR fixes a number of bugs that I discovered when running a popular SQL benchmark. It does not fix all of them.
What changes are included in this PR?
BETWEEN
+ INTERVAL
Date32
andDate64
Are there any user-facing changes?
No